package view.dialogs;

import javax.swing.JPanel;

import view.components.SubnetComboBox;
import view.listeners.CancelListener;
import view.listeners.MultiIpListener;
import view.listeners.SizeBoxListener;
import view.views.dialogButtonViews.AddIpButtonPanel;
import view.views.dialogContentViews.MultiAddIpContentPanel;
import view.views.dialogContentViews.MultiListPanel;

public class MultiIpAddDialog extends Dialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SubnetComboBox subnetCombo;
	private JPanel multiPanel;
	private MultiListPanel multiIpList;

	public MultiIpAddDialog(String title) {
		super(title);

	}

	@Override
	protected JPanel addContent() {
		MultiAddIpContentPanel content = new MultiAddIpContentPanel();
		subnetCombo = content.getComboBox();
		multiPanel = content.getVariable();
		subnetCombo.getBox().addItemListener(
				new SizeBoxListener(this, subnetCombo, multiPanel, multiIpList,
						content));

		return content;
	}

	@Override
	protected JPanel addButtons() {
		AddIpButtonPanel buttons = new AddIpButtonPanel();

		buttons.getCancelButton().addActionListener(new CancelListener(this));

		buttons.getAddButton().addActionListener(
				new MultiIpListener(this, subnetCombo));

		return buttons;
	}

}
